package com.simple.dsrouter.config;

import java.util.List;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
import com.thoughtworks.xstream.annotations.XStreamImplicit;

@XStreamAlias("datasource")
public class DataSourceConfig {
	/**
	 * 数据源分组id
	 */
	@XStreamAsAttribute()
	private String groupId;
	/**
	 * 数据源id
	 */
	@XStreamAsAttribute()
	private String datasourceId;
	/**
	 * 数据源类型
	 */
	@XStreamAsAttribute()
	private String type;
	/**
	 * 数据源权重
	 */
	@XStreamAsAttribute()
	private int weight;
	
	@XStreamImplicit()
	private List<TableConfig> tables;

	public String getGroupId() {
		return groupId;
	}

	public void setGroupId(String groupId) {
		this.groupId = groupId;
	}

	public String getDatasourceId() {
		return datasourceId;
	}

	public void setDatasourceId(String datasourceId) {
		this.datasourceId = datasourceId;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public int getWeight() {
		return weight;
	}

	public void setWeight(int weight) {
		this.weight = weight;
	}

	public List<TableConfig> getTables() {
		return tables;
	}

	public void setTables(List<TableConfig> tables) {
		this.tables = tables;
	}

	public enum DataSourceType {
		READ, WRITE;
	}
}
